package com.loe.ui

import com.loe.mvp.BaseView
import com.loe.mvp.ext_app.XIntent
import com.loe.ui.page.UiActivity

const val LOE_HEAD = "loe://"

fun BaseView.openUrl(urlString: String): XIntent
{
    if(urlString.startsWith(LOE_HEAD))
    {
        val xIntent = start(UiActivity::class)
        xIntent.putExtra("url", urlString)
        return xIntent
    }
    // 主项目处理
    return LoeUI.onOpenUrl!!.invoke(this, urlString)
}

fun BaseView.openUI(urlString: String): XIntent
{
    return if(!urlString.startsWith(LOE_HEAD))
    {
        openUrl(LOE_HEAD + urlString)
    }else
    {
        openUrl(urlString)
    }
}